package geektime.spring.hello.hellospring.service;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import geektime.spring.hello.hellospring.dao.CityDao;
import geektime.spring.hello.hellospring.entity.City;
import lombok.extern.slf4j.Slf4j;

@Service
@Slf4j
public class TestService {
	@Autowired
	private CityDao cityDao;
	private static final Logger logger = LoggerFactory.getLogger(TestService.class);
	@Async
	public List<City> getAll() throws InterruptedException {
		Thread.sleep(5000);
		logger.info("-----------处理数据-----------");
		return cityDao.getAll();
	}
}
